// TCP 服务端 
// 负责启动服务器


#include <iostream>
#include "Common.hpp"
#include "TcpServer.hpp"
#include <memory>

void Usage()
{
    std::cerr << "Usage :  .tcpserver  port " << std::endl;
}

// .tcpserver port 
int main(int argc , char* argv[])
{
    if(argc != 2)
    {
        Usage();
        exit(USAGE_ERROR);
    }

    //端口号转 uint16_t 
    uint16_t port = std::stoi(argv[1]);

    //构建服务器对象
    std::unique_ptr<TcpServer> tcps = std::make_unique<TcpServer>(port);

    tcps->Init();
    tcps->Run();

    return 0;
}